package com.cinema;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import query.DataQuery;

import com.cinema.data.FilmInfo;

public class ComingSoon extends HttpServlet{

	/**
	 * 
	 */
	public ComingSoon(){
		super();
	}
	private static final long serialVersionUID = 4010782057746594985L;
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		List<FilmInfo> filmList = null;
		DataQuery query = new DataQuery();
		filmList = query.getPlanFilmList();
		if(filmList != null){
			req.setAttribute("filmlist", filmList);
			req.setAttribute("status", 2);
			String url = "/currentfilm.jsp";
			RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher(url);
			try {
				dispatcher.forward(req, resp);
			} catch (ServletException e) {
				e.printStackTrace();
			}
		}else{
			resp.sendRedirect("index.jsp");
		}
	}
	
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
		doGet(request, response);
	}
}